Make std::get constexpr git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186525 91177308-0d34-0410-b5e6-96231b3b80d8 
diff --git a/include/__tuple b/include/__tuple index 1213262..9a6b6e0 100644 --- a/include/__tuple +++ b/include/__tuple 
@@ -79,47 +79,47 @@  template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};    template <size_t _Ip, class ..._Tp> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  typename tuple_element<_Ip, tuple<_Tp...> >::type&  get(tuple<_Tp...>&) _NOEXCEPT;    template <size_t _Ip, class ..._Tp> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  const typename tuple_element<_Ip, tuple<_Tp...> >::type&  get(const tuple<_Tp...>&) _NOEXCEPT;    template <size_t _Ip, class ..._Tp> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  typename tuple_element<_Ip, tuple<_Tp...> >::type&&  get(tuple<_Tp...>&&) _NOEXCEPT;    template <size_t _Ip, class _T1, class _T2> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  typename tuple_element<_Ip, pair<_T1, _T2> >::type&  get(pair<_T1, _T2>&) _NOEXCEPT;    template <size_t _Ip, class _T1, class _T2> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  const typename tuple_element<_Ip, pair<_T1, _T2> >::type&  get(const pair<_T1, _T2>&) _NOEXCEPT;    template <size_t _Ip, class _T1, class _T2> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  typename tuple_element<_Ip, pair<_T1, _T2> >::type&&  get(pair<_T1, _T2>&&) _NOEXCEPT;    template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  _Tp&  get(array<_Tp, _Size>&) _NOEXCEPT;    template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  const _Tp&  get(const array<_Tp, _Size>&) _NOEXCEPT;    template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  _Tp&&  get(array<_Tp, _Size>&&) _NOEXCEPT;   
diff --git a/include/array b/include/array index bcf5347..86d1fc0 100644 --- a/include/array +++ b/include/array 
@@ -59,14 +59,14 @@    // element access:  reference operator[](size_type n); - const_reference operator[](size_type n) const; - const_reference at(size_type n) const; + const_reference operator[](size_type n) const; // constexpr in C++14 + const_reference at(size_type n) const; // constexpr in C++14  reference at(size_type n);    reference front(); - const_reference front() const; + const_reference front() const; // constexpr in C++14  reference back(); - const_reference back() const; + const_reference back() const; // constexpr in C++14    T* data() noexcept;  const T* data() const noexcept; @@ -92,9 +92,9 @@  template <int I, class T> class tuple_element;  template <class T, size_t N> struct tuple_size<array<T, N>>;  template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>; -template <int I, class T, size_t N> T& get(array<T, N>&) noexcept; -template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept; -template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; +template <int I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14 +template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14 +template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14    } // std   @@ -181,14 +181,14 @@    // element access:  _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];} - _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const {return __elems_[__n];} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];}  reference at(size_type __n); - const_reference at(size_type __n) const; + _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;    _LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];} - _LIBCPP_INLINE_VISIBILITY const_reference front() const {return __elems_[0];} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}  _LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];} - _LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}    _LIBCPP_INLINE_VISIBILITY  value_type* data() _NOEXCEPT {return __elems_;} @@ -210,6 +210,7 @@  }    template <class _Tp, size_t _Size> +_LIBCPP_CONSTEXPR_AFTER_CXX11  typename array<_Tp, _Size>::const_reference  array<_Tp, _Size>::at(size_type __n) const  { @@ -306,32 +307,32 @@  };    template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_INLINE_VISIBILITY inline +_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR_AFTER_CXX11  _Tp&  get(array<_Tp, _Size>& __a) _NOEXCEPT  {  static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)"); - return __a[_Ip]; + return __a.__elems_[_Ip];  }    template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_INLINE_VISIBILITY inline +_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR_AFTER_CXX11  const _Tp&  get(const array<_Tp, _Size>& __a) _NOEXCEPT  {  static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)"); - return __a[_Ip]; + return __a.__elems_[_Ip];  }    #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES    template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_INLINE_VISIBILITY inline +_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR_AFTER_CXX11  _Tp&&  get(array<_Tp, _Size>&& __a) _NOEXCEPT  {  static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)"); - return _VSTD::move(__a[_Ip]); + return _VSTD::move(__a.__elems_[_Ip]);  }    #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 
diff --git a/include/tuple b/include/tuple index c7a1c14..5d5debf 100644 --- a/include/tuple +++ b/include/tuple 
@@ -86,13 +86,13 @@  // 20.4.1.5, element access:  template <intsize_t I, class... T>  typename tuple_element<I, tuple<T...>>::type& - get(tuple<T...>&) noexcept; + get(tuple<T...>&) noexcept; // constexpr in C++14  template <intsize_t I, class... T>  typename tuple_element<I, tuple<T...>>::type const& - get(const tuple<T...>&) noexcept; + get(const tuple<T...>&) noexcept; // constexpr in C++14  template <intsize_t I, class... T>  typename tuple_element<I, tuple<T...>>::type&& - get(tuple<T...>&&) noexcept; + get(tuple<T...>&&) noexcept; // constexpr in C++14    template <class T1, class... T>  constexpr T1& get(tuple<T...>&) noexcept; // C++14 @@ -546,11 +546,11 @@    base base_;   - template <size_t _Jp, class ..._Up> friend + template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11  typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT; - template <size_t _Jp, class ..._Up> friend + template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11  const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT; - template <size_t _Jp, class ..._Up> friend + template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11  typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;  public:   @@ -763,7 +763,7 @@  // get    template <size_t _Ip, class ..._Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  typename tuple_element<_Ip, tuple<_Tp...> >::type&  get(tuple<_Tp...>& __t) _NOEXCEPT  { @@ -772,7 +772,7 @@  }    template <size_t _Ip, class ..._Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  const typename tuple_element<_Ip, tuple<_Tp...> >::type&  get(const tuple<_Tp...>& __t) _NOEXCEPT  { @@ -781,7 +781,7 @@  }    template <size_t _Ip, class ..._Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  typename tuple_element<_Ip, tuple<_Tp...> >::type&&  get(tuple<_Tp...>&& __t) _NOEXCEPT  { 
diff --git a/include/utility b/include/utility index 2d2670d..d36cf9d 100644 --- a/include/utility +++ b/include/utility 
@@ -107,15 +107,15 @@    template<size_t I, class T1, class T2>  typename tuple_element<I, std::pair<T1, T2> >::type& - get(std::pair<T1, T2>&) noexcept; + get(std::pair<T1, T2>&) noexcept; // constexpr in C++14    template<size_t I, class T1, class T2>  const typename const tuple_element<I, std::pair<T1, T2> >::type& - get(const std::pair<T1, T2>&) noexcept; + get(const std::pair<T1, T2>&) noexcept; // constexpr in C++14    template<size_t I, class T1, class T2>  typename tuple_element<I, std::pair<T1, T2> >::type&& - get(std::pair<T1, T2>&&) noexcept; + get(std::pair<T1, T2>&&) noexcept; // constexpr in C++14    template<class T1, class T2>  constexpr T1& get(std::pair<T1, T2>&) noexcept; // C++14 @@ -546,13 +546,13 @@  {  template <class _T1, class _T2>  static - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  _T1&  get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}    template <class _T1, class _T2>  static - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  const _T1&  get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}   @@ -560,7 +560,7 @@    template <class _T1, class _T2>  static - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  _T1&&  get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T1>(__p.first);}   @@ -572,13 +572,13 @@  {  template <class _T1, class _T2>  static - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  _T2&  get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}    template <class _T1, class _T2>  static - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  const _T2&  get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}   @@ -586,7 +586,7 @@    template <class _T1, class _T2>  static - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11  _T2&&  get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T2>(__p.second);}   @@ -594,7 +594,7 @@  };    template <size_t _Ip, class _T1, class _T2> -_LIBCPP_INLINE_VISIBILITY inline +_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR_AFTER_CXX11  typename tuple_element<_Ip, pair<_T1, _T2> >::type&  get(pair<_T1, _T2>& __p) _NOEXCEPT  { @@ -602,7 +602,7 @@  }    template <size_t _Ip, class _T1, class _T2> -_LIBCPP_INLINE_VISIBILITY inline +_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR_AFTER_CXX11  const typename tuple_element<_Ip, pair<_T1, _T2> >::type&  get(const pair<_T1, _T2>& __p) _NOEXCEPT  { @@ -612,7 +612,7 @@  #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES    template <size_t _Ip, class _T1, class _T2> -_LIBCPP_INLINE_VISIBILITY inline +_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR_AFTER_CXX11  typename tuple_element<_Ip, pair<_T1, _T2> >::type&&  get(pair<_T1, _T2>&& __p) _NOEXCEPT  { 
diff --git a/test/containers/sequences/array/array.size/size.pass.cpp b/test/containers/sequences/array/array.size/size.pass.cpp index 4078fd5..fe5a0d5 100644 --- a/test/containers/sequences/array/array.size/size.pass.cpp +++ b/test/containers/sequences/array/array.size/size.pass.cpp 
@@ -21,12 +21,16 @@  typedef std::array<T, 3> C;  C c = {1, 2, 3.5};  assert(c.size() == 3); + assert(c.max_size() == 3); + assert(!c.empty());  }  {  typedef double T;  typedef std::array<T, 0> C;  C c = {};  assert(c.size() == 0); + assert(c.max_size() == 0); + assert(c.empty());  }  #ifndef _LIBCPP_HAS_NO_CONSTEXPR  { @@ -34,12 +38,16 @@  typedef std::array<T, 3> C;  constexpr C c = {1, 2, 3.5};  static_assert(c.size() == 3, ""); + static_assert(c.max_size() == 3, ""); + static_assert(!c.empty(), "");  }  {  typedef double T;  typedef std::array<T, 0> C;  constexpr C c = {};  static_assert(c.size() == 0, ""); + static_assert(c.max_size() == 0, ""); + static_assert(c.empty(), "");  }  #endif  } 
diff --git a/test/containers/sequences/array/array.tuple/get.pass.cpp b/test/containers/sequences/array/array.tuple/get.pass.cpp index 9820bab..d9e242c 100644 --- a/test/containers/sequences/array/array.tuple/get.pass.cpp +++ b/test/containers/sequences/array/array.tuple/get.pass.cpp 
@@ -14,6 +14,16 @@  #include <array>  #include <cassert>   +#if __cplusplus > 201103L +struct S { + std::array<int, 3> a; + int k; + constexpr S() : a{1,2,3}, k(std::get<2>(a)) {} + }; + +constexpr std::array<int, 2> getArr () { return { 3, 4 }; } +#endif +  int main()  {  { @@ -25,4 +35,18 @@  assert(c[1] == 5.5);  assert(c[2] == 3.5);  } +#if _LIBCPP_STD_VER > 11 + { + typedef double T; + typedef std::array<T, 3> C; + constexpr C c = {1, 2, 3.5}; + static_assert(std::get<0>(c) == 1, ""); + static_assert(std::get<1>(c) == 2, ""); + static_assert(std::get<2>(c) == 3.5, ""); + } + { + static_assert(S().k == 3, ""); + static_assert(std::get<1>(getArr()) == 4, ""); + } +#endif  } 
diff --git a/test/containers/sequences/array/array.tuple/get_const.pass.cpp b/test/containers/sequences/array/array.tuple/get_const.pass.cpp index 6ede8f0..1cbdfa4 100644 --- a/test/containers/sequences/array/array.tuple/get_const.pass.cpp +++ b/test/containers/sequences/array/array.tuple/get_const.pass.cpp 
@@ -24,4 +24,14 @@  assert(std::get<1>(c) == 2);  assert(std::get<2>(c) == 3.5);  } +#if _LIBCPP_STD_VER > 11 + { + typedef double T; + typedef std::array<T, 3> C; + constexpr const C c = {1, 2, 3.5}; + static_assert(std::get<0>(c) == 1, ""); + static_assert(std::get<1>(c) == 2, ""); + static_assert(std::get<2>(c) == 3.5, ""); + } +#endif  } 
diff --git a/test/containers/sequences/array/at.pass.cpp b/test/containers/sequences/array/at.pass.cpp new file mode 100644 index 0000000..b5cf8a5 --- /dev/null +++ b/test/containers/sequences/array/at.pass.cpp 
@@ -0,0 +1,67 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <array> + +// reference operator[] (size_type) +// const_reference operator[] (size_type); // constexpr in C++14 +// reference at (size_type) +// const_reference at (size_type); // constexpr in C++14 + +#include <array> +#include <cassert> + +int main() +{ + { + typedef double T; + typedef std::array<T, 3> C; + C c = {1, 2, 3.5}; + C::reference r1 = c.at(0); + assert(r1 == 1); + r1 = 5.5; + assert(c.front() == 5.5); +  + C::reference r2 = c.at(2); + assert(r2 == 3.5); + r2 = 7.5; + assert(c.back() == 7.5); + + try { (void) c.at(3); } + catch (const std::out_of_range &) {} + } + { + typedef double T; + typedef std::array<T, 3> C; + const C c = {1, 2, 3.5}; + C::const_reference r1 = c.at(0); + assert(r1 == 1); +  + C::const_reference r2 = c.at(2); + assert(r2 == 3.5); + + try { (void) c.at(3); } + catch (const std::out_of_range &) {} + } +  +#if _LIBCPP_STD_VER > 11  + { + typedef double T; + typedef std::array<T, 3> C; + constexpr C c = {1, 2, 3.5}; + + constexpr T t1 = c.at(0); + static_assert (t1 == 1, ""); + + constexpr T t2 = c.at(2); + static_assert (t2 == 3.5, ""); + } +#endif + +} 
diff --git a/test/containers/sequences/array/front_back.pass.cpp b/test/containers/sequences/array/front_back.pass.cpp new file mode 100644 index 0000000..45a963b --- /dev/null +++ b/test/containers/sequences/array/front_back.pass.cpp 
@@ -0,0 +1,62 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <array> + +// reference front(); +// reference back(); +// const_reference front(); // constexpr in C++14 +// const_reference back(); // constexpr in C++14 + +#include <array> +#include <cassert> + +int main() +{ + { + typedef double T; + typedef std::array<T, 3> C; + C c = {1, 2, 3.5}; + + C::reference r1 = c.front(); + assert(r1 == 1); + r1 = 5.5; + assert(c[0] == 5.5); +  + C::reference r2 = c.back(); + assert(r2 == 3.5); + r2 = 7.5; + assert(c[2] == 7.5); + } + { + typedef double T; + typedef std::array<T, 3> C; + const C c = {1, 2, 3.5}; + C::const_reference r1 = c.front(); + assert(r1 == 1); + + C::const_reference r2 = c.back(); + assert(r2 == 3.5); + } + +#if _LIBCPP_STD_VER > 11  + { + typedef double T; + typedef std::array<T, 3> C; + constexpr C c = {1, 2, 3.5}; +  + constexpr T t1 = c.front(); + static_assert (t1 == 1, ""); + + constexpr T t2 = c.back(); + static_assert (t2 == 3.5, ""); + } +#endif + +} 
diff --git a/test/containers/sequences/array/indexing.pass.cpp b/test/containers/sequences/array/indexing.pass.cpp new file mode 100644 index 0000000..e4dda0d --- /dev/null +++ b/test/containers/sequences/array/indexing.pass.cpp 
@@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <array> + +// reference operator[] (size_type) +// const_reference operator[] (size_type); // constexpr in C++14 +// reference at (size_type) +// const_reference at (size_type); // constexpr in C++14 + +#include <array> +#include <cassert> + +int main() +{ + { + typedef double T; + typedef std::array<T, 3> C; + C c = {1, 2, 3.5}; + C::reference r1 = c[0]; + assert(r1 == 1); + r1 = 5.5; + assert(c.front() == 5.5); +  + C::reference r2 = c[2]; + assert(r2 == 3.5); + r2 = 7.5; + assert(c.back() == 7.5); + } + { + typedef double T; + typedef std::array<T, 3> C; + const C c = {1, 2, 3.5}; + C::const_reference r1 = c[0]; + assert(r1 == 1); + C::const_reference r2 = c[2]; + assert(r2 == 3.5); + } +  +#if _LIBCPP_STD_VER > 11  + { + typedef double T; + typedef std::array<T, 3> C; + constexpr C c = {1, 2, 3.5}; +  + constexpr T t1 = c[0]; + static_assert (t1 == 1, ""); + + constexpr T t2 = c[2]; + static_assert (t2 == 3.5, ""); + } +#endif + +} 
diff --git a/test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp b/test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp index 43e70ea..fcda366 100644 --- a/test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp +++ b/test/utilities/utility/pairs/pair.astuple/get_const.pass.cpp 
@@ -31,10 +31,8 @@  {  typedef std::pair<int, short> P;  constexpr P p1(3, 4); - static_assert(p1.first == 3, "" ); // for now! - static_assert(p1.second == 4, "" ); // for now! -// static_assert(std::get<0>(p1) == 3, ""); -// static_assert(std::get<1>(p1) == 4, ""); + static_assert(std::get<0>(p1) == 3, ""); + static_assert(std::get<1>(p1) == 4, "");  }  #endif  } 
diff --git a/test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp b/test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp index ebfbe9e..6d61c47 100644 --- a/test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp +++ b/test/utilities/utility/pairs/pair.astuple/get_non_const.pass.cpp 
@@ -18,6 +18,16 @@  #include <utility>  #include <cassert>   +#if __cplusplus > 201103L +struct S { + std::pair<int, int> a; + int k; + constexpr S() : a{1,2}, k(std::get<0>(a)) {} + }; + +constexpr std::pair<int, int> getP () { return { 3, 4 }; } +#endif +  int main()  {  { @@ -30,4 +40,12 @@  assert(std::get<0>(p) == 5);  assert(std::get<1>(p) == 6);  } + +#if __cplusplus > 201103L + { + static_assert(S().k == 1, ""); + static_assert(std::get<1>(getP()) == 4, ""); + } +#endif +  }